#ifndef TESTINGSET_HPP_INCLUDED
#define TESTINGSET_HPP_INCLUDED

#include "Graph.hpp"
#include "GraphDatabase.hpp"

//#include <boost/archive/binary_oarchive.hpp>
//#include <boost/archive/binary_iarchive.hpp>

namespace TopologicalLearner
{
/**
 * This class defines a testing set that is used to evaluate different predictors in the AlgorithmStats class.
 * The class contains a vector that consists of a graph ID of a graph database, and a subgraph of this
 * specific graph that will be used to do prediction upon.
 * It also contains a size vector that specifies how many graph we have of different graph size.
*/
class TestingSet
{
private:





public:

    /// This records how many partial graphs of a given size there is in this TestingSet
    std::vector<unsigned int> m_PGSizes;

    /// Graph ID and the partial graph
    std::vector< std::pair<unsigned int, Graph> > m_PGs;

    std::map< int, std::map<Vertex, Vertex> > m_partialToTestedGraphMap;

    template<class Archive>
    void serialize(Archive &ar, const unsigned int version)
    {
        ar & m_PGSizes;
        ar & m_PGs;
        ar & m_partialToTestedGraphMap;
    }

    /**
    * Saves the TestingSet to file by using a boost::binary archive.
    */
    void Save(std::string sFilename) const;

    /**
    * Loads the TestingSet from file by using a boost::binary archive.
    */
    void Load(std::string sFilename);

    /// After running a test, this vector is filled with the ID's of the partial graphs that the prediction failed upon
    std::vector<int> iFailedIDs;

    /// After running a test, this vector is filled with the ID's of the partial graphs that the prediction succeeded upon
    std::vector<int> iSuccIDs;

    /**
    * Gives a partial graph and its graph ID.
    * @return A pair consisting of first the ID of the graph in the graph database, and the second component
    * is the partial graph (the subgraph) of that graph.
    */
    std::pair<unsigned int, Graph> GetPGData(int iID) { return m_PGs[iID]; }

    /**
    * This function generates a TestingSet upon which we will perform the predictions
    * PGSizes records how many partial graphs of a given size there is in this TestingSet
    * For example, we might demand that we want 100 PGs of size 2, 50 of size 3, and 0 otherwise.
    * That is, PGSizes[2] = 100; PGSizes[3] = 50;
    * @param PGSizes A vector specifying how many graphs we should generate for each size
    */
    void GenerateTestingSet(std::vector<unsigned int> PGSizes, const GraphDatabase& D);

    friend class AlgorithmStats;
    friend class GraphExploration;
};
}

#endif // TESTINGSET_HPP_INCLUDED
